package 数组.easy;

import java.util.Arrays;

/**
 * @author Lw中
 * @date 2020/10/5 8:02
 */
public class YiSiLuLing {

    /**
     * 通过翻转子数组使两个数组相等
     * @param target
     * @param arr
     * @return
     */
    public static boolean canBeEqual(int[] target, int[] arr) {
        Arrays.sort(arr);
        Arrays.sort(target);
        for (int i = 0; i < target.length; i++) {
            if (arr[i] != target[i]) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        int[] num1 = {1,2,3,4};
        int[] num2 = {2,4,1,3};
        boolean b = canBeEqual(num1, num2);
        System.out.println(b);
    }

}
